package com.example.kothin_study.utils

import android.content.Context
import android.widget.Toast

/**
 *@author cy
 *@date 2024/8/14
 *@apiNote
 */
fun <T : Comparable<T>> max(vararg nums:T):T{
    if(nums.isEmpty()){
        throw IllegalArgumentException("Array is empty")
    }
    var maxNum=nums[0]
    for(num in nums){
        if(num>maxNum){
            maxNum=num
        }
    }
    return maxNum
}
fun String.showToast(context: Context, duration: Int = Toast.LENGTH_SHORT) {
    Toast.makeText(context, this, duration).show()
}

fun Int.showToast(context: Context, duration: Int = Toast.LENGTH_SHORT) {
    Toast.makeText(context, this, duration).show()
    println(465 )
    println("lsp,hello!!!")
    println("你好啊,你写的代码也太好了!!!")



}





fun main() {
    val maxNumber = max(1.0, 2.5, 3.8, 4.9, 50.5)
//    println("Max number is $maxNumber") // Output: Max number is 5

}